package com.ruoyi.tea.service.impl;

import java.util.List;
import java.util.Map;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.tea.domain.TeaRecoring;
import com.ruoyi.tea.domain.TeaUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.tea.mapper.TeaSeeMediaMapper;
import com.ruoyi.tea.domain.TeaSeeMedia;
import com.ruoyi.tea.service.ITeaSeeMediaService;
import com.ruoyi.common.core.text.Convert;

/**
 * 用户观看录播记录Service业务层处理
 *
 * @author ruoyi
 * @date 2022-07-31
 */
@Service
public class TeaSeeMediaServiceImpl implements ITeaSeeMediaService {
    @Autowired
    private TeaSeeMediaMapper teaSeeMediaMapper;

    /**
     * 查询用户观看录播记录
     *
     * @param id 用户观看录播记录主键
     * @return 用户观看录播记录
     */
    @Override
    public TeaSeeMedia selectTeaSeeMediaById(Long id) {
        return teaSeeMediaMapper.selectTeaSeeMediaById(id);
    }

    /**
     * 查询用户观看录播记录列表
     *
     * @param teaSeeMedia 用户观看录播记录
     * @return 用户观看录播记录
     */
    @Override
    public List<TeaSeeMedia> selectTeaSeeMediaList(TeaSeeMedia teaSeeMedia) {
        return teaSeeMediaMapper.selectTeaSeeMediaList(teaSeeMedia);
    }

    /**
     * 新增用户观看录播记录
     *
     * @param teaSeeMedia 用户观看录播记录
     * @return 结果
     */
    @Override
    public int insertTeaSeeMedia(TeaSeeMedia teaSeeMedia) {
        teaSeeMedia.setCreateTime(DateUtils.getNowDate());
        return teaSeeMediaMapper.insertTeaSeeMedia(teaSeeMedia);
    }

    /**
     * 修改用户观看录播记录
     *
     * @param teaSeeMedia 用户观看录播记录
     * @return 结果
     */
    @Override
    public int updateTeaSeeMedia(TeaSeeMedia teaSeeMedia) {
        return teaSeeMediaMapper.updateTeaSeeMedia(teaSeeMedia);
    }

    /**
     * 批量删除用户观看录播记录
     *
     * @param ids 需要删除的用户观看录播记录主键
     * @return 结果
     */
    @Override
    public int deleteTeaSeeMediaByIds(String ids) {
        return teaSeeMediaMapper.deleteTeaSeeMediaByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除用户观看录播记录信息
     *
     * @param id 用户观看录播记录主键
     * @return 结果
     */
    @Override
    public int deleteTeaSeeMediaById(Long id) {
        return teaSeeMediaMapper.deleteTeaSeeMediaById(id);
    }

    /**
     * 获取个人观看时长
     *
     * @param params
     * @return
     */
    @Override
    public Long seeDuration(Map<String, Object> params) {
        return teaSeeMediaMapper.seeDuration(params);
    }

    /**
     * 获取个人观看历史记录
     *
     * @param teaUser
     * @return
     */
    @Override
    public List<TeaRecoring> seeHsitory(TeaUser teaUser) {
        return teaSeeMediaMapper.seeHsitory(teaUser);
    }
}
